home *** CD-ROM | disk | FTP | other *** search
- Path: hoho.quake.net!usenet
- From: billf@jovial.com (Bill Foote)
- Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
- Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
- Date: 23 Mar 1996 05:55:47 GMT
- Organization: Jovial
- Message-ID: <4j03p4$fbt@hoho.quake.net>
- References: <1996Mar14.155641.4299@schbbs.mot.com> <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>
- NNTP-Posting-Host: l89.ip.quake.net
-
- In article <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>,
- Matthew Travis <mtravis@students.uiuc.edu> wrote:
- >H'llo,
- > for clarification, Java uses the same exception handling
- >mechanism as C++ (with the addition of the finally clause). The two
- >possible mechanisms are "resumption" and "termination". A quote from the
- >"Annotated C++ Reference Manual" states:
- >
- > "Exception handling is intended to allow code that has encountered
- >a condition it cannot cope with to return to some other code that
- >directly or indirectly invoked it. There is no way for an exception
- >handler to request the thread of control to resume from the throw point.
- >In other words, "throw" implements the termination model of exception
- >handling." -ARM, Ellis & Stroustrup, page 354
- >
- >This model has been accepted into the draft C++ standard and is also the
- >model Java uses. The philosophy is that an exception indicates some error
- >condition that is usually unrecoverable and code that is in error should
- >terminate (thinking about it logically).
-
- A cynic might conclude something more along these lines: "It would be hard
- to implement resumable exceptions in C++, so they decided to punt."
-
- It's not too hard to come up with examples where it would be nice to have
- resumable exceptions. One example is resource acquisition. Upon failure
- to acquire a resource (a file descriptor, some memory, etc.) it might be
- nice if a top-level exception handler could try to free up some resources,
- and if it can, try to resume from the exception.
-
-
- Oh well.
- --
- Bill Foote | L'homme est nΘ pour vivre dans les
- billf@jovial.com | convulsions de l'inquiΘtude ou dans la
- http://www.jovial.com/~billf/ | lΘthargie de l'ennui -- Voltaire
-